package com.ljf.common.model;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 基础实体类
 *
 * @author LJF
 * @since 2024-01-22
 */
@Data
public abstract class BasisModel implements Serializable {

    private static final long serialVersionUID = -1L;

    /**
     * Java类型:Integer
     * 数据库类型:tinyint(1)
     * 注释:状态：0-->启用；1-->停用
     * {@link BasisModel#COL_STATE}
     * {@link com.ljf.common.enums.StateEnum}
     */
    @JsonProperty("state")
    @TableField(value = "state")
    @ApiModelProperty(value = "状态")
    private Integer state;

    /**
     * Java类型:String
     * 数据库类型:char(8)
     * 注释:创建人ID
     * {@link BasisModel#COL_CREATOR_ID}
     */
    @JsonProperty("creatorId")
    @ApiModelProperty(value = "创建人ID")
    @TableField(value = "creator_id", fill = FieldFill.INSERT)
    private String creatorId;

    /**
     * Java类型:Date
     * 数据库类型:datetime
     * 注释:创建时间
     * {@link BasisModel#COL_CREATE_TIME}
     */
    @JsonProperty("createTime")
    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * Java类型:String
     * 数据库类型:char(8)
     * 注释:修改人ID
     * {@link BasisModel#COL_MODIFIER_ID}
     */
    @JsonProperty("modifierId")
    @ApiModelProperty(value = "修改人ID")
    @TableField(value = "modifier_id", fill = FieldFill.INSERT_UPDATE)
    private String modifierId;

    /**
     * Java类型:Date
     * 数据库类型:datetime
     * 注释:修改时间
     * {@link BasisModel#COL_MODIFY_TIME}
     */
    @JsonProperty("modifyTime")
    @ApiModelProperty(value = "修改时间")
    @TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date modifyTime;

    /**
     * Java类型:Integer
     * 数据库类型:int
     * 注释:版本号
     * {@link BasisModel#COL_VERSION}
     */
    @JsonProperty("version")
    @ApiModelProperty(value = "版本号")
    @TableField(value = "version", fill = FieldFill.INSERT)
    private Integer version;


    /**
     * 状态：0-->启用；1-->停用
     * {@link BasisModel#state}
     */
    public static final String COL_STATE = "state";
    /**
     * 创建人ID
     * {@link BasisModel#creatorId}
     */
    public static final String COL_CREATOR_ID = "creator_id";
    /**
     * 创建时间
     * {@link BasisModel#createTime}
     */
    public static final String COL_CREATE_TIME = "create_time";
    /**
     * 修改人ID
     * {@link BasisModel#modifierId}
     */
    public static final String COL_MODIFIER_ID = "modifier_id";
    /**
     * 修改时间
     * {@link BasisModel#modifyTime}
     */
    public static final String COL_MODIFY_TIME = "modify_time";
    /**
     * 版本号
     * {@link BasisModel#version}
     */
    public static final String COL_VERSION = "version";

}
